package flymoke.reflect;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class ReflectGetMethod {
	public static void main(String[] args) {
		Class<?> cla = null;
		try {
			cla = Class.forName("flymoke.reflect.People");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		
		Method[] mod = cla.getDeclaredMethods();
		for (int i = 0; i < mod.length; i++) {
			int mon = mod[i].getModifiers();
			String method = Modifier.toString(mon);
			Class<?> type = mod[i].getReturnType();
			System.out.println(method+" "+type.getName()+"  "+mod[i].getName());
		}
		
		try {
			Method me = cla.getMethod("sayChina");
			me.invoke(cla.newInstance());
		} catch (Exception e) {
			e.printStackTrace();
		} 
		
	}
}
